<?php
class SearchAction extends Action{
     function _initialize() {
		
	 }
     public function index(){
	 
	 $this->display();
	 }
	 public function qiugou(){
	 
	 $this->display('index');
	 }
	 public function user(){
	 
	 $this->display('index');
	 }
	 
	 //高级商品
     public function hsg(){
	 
	 $this->display('hs');
	 }
	 //高级求购
     public function hsq(){
	 
	 $this->display('hs');
	 }
	 //高级用户
    public function hsu(){
	 
	 $this->display('hs');
	 }
	 
	 //高级搜索
    public function sg(){
	 $keys=$this->__getSearchKey();
	 print_r($keys);
	
	 $this->display('goodslist');
	}
    public function sq(){
	
	
	 $this->display();
	}
    public function su(){
	 $this->display();
	}
	
	private function __getSearchKey() {
		$keys = '';
		// 
		if (isset ( $_REQUEST ['k'] ) && ! empty ( $_REQUEST ['k'] )) {
			$keys = array();
			$keys['key']    = $_POST['k'];
			$keys['type']   = $_POST['t']; 
			$keys['school'] = $_POST['s'];
			//$sc = html_entity_decode ( urldecode ( $_GET ['k'] ), ENT_QUOTES );
			// 
			if (mb_strlen ( $keys['key'], 'UTF8' ) > 30)
				$keys['key'] = mb_substr ( $keys['key'], 0, 30, 'UTF8' );
			$_SESSION ['home_user_search_key'] = serialize ( $keys['key'] );
		    $_SESSION ['home_user_search_type'] = serialize ( $keys['type'] );
			$_SESSION ['home_user_search_school'] = serialize ( $keys['school'] );
		} else if (is_numeric ( $_GET [C ( 'VAR_PAGE' )] )) {
			$keys['key'] = unserialize ( $_SESSION ['home_user_search_key'] );
		    $keys['key'] = unserialize ( $_SESSION ['home_user_search_type'] );
		    $keys['key'] = unserialize ( $_SESSION ['home_user_search_school'] );
		} else {
			//unset($_SESSION['home_user_search_key']);
		}
		//echo unserialize ($_SESSION ['home_user_search_key']);
		return trim ( $keys );
	}
}

?>